home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000212_news@newsmaster….columbia.edu _Thu Aug 21 20:14:54 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  5KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id UAA17520
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Thu, 21 Aug 1997 20:14:53 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id UAA02802
  7.     for kermit.misc@watsun; Thu, 21 Aug 1997 20:14:53 -0400 (EDT)
  8. Path: news.columbia.edu!panix!howland.erols.net!infeed2.internetmci.com!newsfeed.internetmci.com!207.49.14.4!news.wolsi.com!news.aros.net!news.cs.utah.edu!cc.usu.edu!jrd
  9. From: jrd@cc.usu.edu (Joe Doupnik)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: echo command works differently between 3.14 and 3.15
  12. Message-ID: <KM7xYazirna0@cc.usu.edu>
  13. Date: 21 Aug 97 16:56:12 MDT
  14. References: <33f9b133.266082@news.calvacom.fr> <PYDViO7VXbx1@cc.usu.edu>
  15. Organization: Utah State University
  16. Lines: 95
  17. Xref: news.columbia.edu comp.protocols.kermit.misc:7527
  18.  
  19. In article <PYDViO7VXbx1@cc.usu.edu>, jrd@cc.usu.edu (Joe Doupnik) writes:
  20. > In article <33f9b133.266082@news.calvacom.fr>, do11@calva.net (Dominique Ottello) writes:
  21. >> Hello from France.
  22. >> 
  23. >> I apologize for my wrong English. I hope you understand me.
  24. >> 
  25. >> I think there is a problem with echo command within a take file between
  26. >> MS-DOS Kermit 3.14 and 3.15 beta 21
  27. >> 
  28. >> With MS-DOS Kermit 3.14 both the macro Disp and the echo command will
  29. >> display "Yes" in green (With ANSI.SYS loaded).
  30. >> 
  31. >> With MS-DOS Kermit 3.15 only the macro Disp displays "Yes" in green.
  32. >> Echo command displays the contents of macro's Ge and No.
  33. >> ANSI escape sequences are not correctly executed when these sequences are
  34. >> within a macro inside an echo command.
  35. >>             (See macro and commands hereunder)
  36. >> 
  37. >> ; Displays White  on Blue
  38. >> assign No \27[0;1;37;44m
  39. >> ; Displays Green  on Blue
  40. >> assign Ge \27[0;1;32;44m
  41. >> assign Disp echo {From Macro Disp : \m(Ge)Yes\m(No)}
  42. >> Disp
  43. >> echo {From Echo Command : \m(Ge)Yes\m(No)}
  44. >> 
  45. > ---------
  46. >     Translating this into words for other readers, ASSIGN evaluates
  47. > its arguments before storing the result into the named variable. DEFINE
  48. > does not. Neither changes \numbers to binary form.
  49. >         Next, processing \m(macro-name) is a parallel process to reducing
  50. > \numbers, not an iterative one. That's the key here. 
  51. > Macro DISP receives argument  
  52. >     echo {From Macro Disp: \27[0;1;32;44mYes\27[0;1;37;44m}
  53. > where the \m(macro-name) parts have had their contents substituted.
  54. > Invoking macro DISP causes the above string to be passed through the parser
  55. > again by the ECHO command, and ECHO asks for \numbers to be converted to
  56. > binary format.
  57. >     Then the single ECHO command below it sees not that \number style
  58. > string but rather \m(macro-name) string, \m(name) items are parsed to their
  59. > replacment text, and thus ECHO sees literal \27[ etc characters. \number and 
  60. > \m(name) are parallel but not self-calling in MSK 3.15. Thus we see \27[  etc
  61. > on the screen.
  62. >     Or in simpler terms, \numbers are not substitution variables.
  63. >     MSK 3.14 did \number conversion in individual commands such as ECHO,
  64. > and hence in series with substitution variable work by the parser, but MSK 
  65. > 3.15 moved \num conversion into the parser in parallel with substitution 
  66. > variables.
  67. ----------
  68.     Adding what I should have done in the above message: how to work
  69. around this effect.
  70.     The solution is to use formal substitution variables, \%letter items.
  71. Then a test Take file might be like this:
  72.  
  73. ; Displays White  on Blue
  74. assign No \27[0;1;37;44m
  75. ; Displays Green  on Blue
  76. assign Ge \27[0;1;32;44m
  77. assign Disp echo {From Macro Disp : \m(Ge)Yes\m(No)}
  78. Disp
  79. echo {From Echo Command : \m(Ge)Yes\m(No)}
  80. ; variable format
  81. echo Variable form
  82. assign \%n \27[0;1;37;44m
  83. ; Displays Green  on Blue
  84. assign \%g \27[0;1;32;44m
  85. assign Disp echo {From Macro Disp : \%gYes\%n}
  86. Disp
  87. echo {From Echo Command : \%gYes\%n}
  88.  
  89.     The second, variable, format works as desired: a green Yes is
  90. displayed by both DISP and ECHO command lines. The reason it works is
  91. because formal substitution variables reevaluate their results recursively,
  92. thus the parser sees \%g, replaces it by \27[ etc and then reevalutes the
  93. string from the \ byte again (and hence sees \27 as a \number to be
  94. reduced to binary).
  95.     Recall, \m(ge) is replaced by the macro ge's definition and that's
  96. that. The definition is not rescanned for \number conversion. Similarly,
  97.     def A this is short
  98.     def b \m(a)
  99.         def c \m(b)
  100.     echo testing \m(c)
  101. yields "testing \m(b)" rather than "testing this is short". 
  102. But
  103.     def \%a this is short
  104.     def \%b \%a
  105.     def \%c \%b
  106.     echo testing \%c
  107. yields "testing this is short", \%a is "this is short", \%b is "\%a",
  108. and \%c is "\%b". Substitution variables reevalute themselves and we get 
  109. down to the bare "this is short" definition in the end.
  110.  
  111.     Cynics may say this is the Computer Science equivalent of lawyer-speak.
  112. I couldn't possible comment on that, unquote.
  113.     Joe D.